<%@ page import="javabean.Customer" %>
<%@ page import="javabean.Package" %>
<%@ page import="DAO.PackageDAO" %>
<%@ page import="DAO.DAOFactory" %>
<%@ page import="javabean.customerPackage" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="DAO.CustomerDAO" %><%--
  Created by IntelliJ IDEA.
  User: 32650
  Date: 2023-05-18
  Time: 2:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ include file="check.jsp" %>
<%
    Customer loginCustomer = (Customer) session.getAttribute("loginCustomer");
    CustomerDAO customerDAO = (CustomerDAO) DAOFactory.getCustomerDAOInstance();
    loginCustomer = customerDAO.searchCustomer(loginCustomer.getCustomerID());
    PackageDAO packageDAO = (PackageDAO) DAOFactory.getPackageDAOInstance();
    customerPackage customerPackage = null;
    Package myPackage = null;
    try {
        customerPackage = packageDAO.GetCustomerPackage(loginCustomer);
        myPackage = packageDAO.getPackageByID(customerPackage.getPackageID());
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }

%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta
            name="viewport"
            content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
    />
    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <link href="css/Bar.css" rel="stylesheet">
    <link href="css/Balance_Search.css" rel="stylesheet">
    <title>移动网上营业厅</title>
</head>
<body>
<div class="header">
    <h2>移动网上营业厅</h2>
</div>
<div class="content">
    <div class="left">
        <ul>
            <li><a href="Personal_Info.jsp">个人信息</a></li>
            <li><a href="MyPackage">我的套餐</a></li>
            <li><a href="Balance.jsp">查询余额</a></li>
            <li><a href="MyBill.jsp">查询账单</a></li>
            <li><a href="Subpackage">套餐订购</a></li>
            <li><a href="Recharge.jsp">充值缴费</a></li>
            <li><a href="MyOrder.jsp">我的订单</a></li>
            <li><a href="MyComplaint">我的投诉</a></li>
            <li><a href="MyMaintenance">我的报修</a></li>
            <li><a href="Account_cancellation.jsp">账号注销</a></li>
            <li><a href="Logout">退出登录</a></li>
        </ul>
    </div>
    <div class="right">
        <section>
            <h1>余额</h1>
            <ul>
                <li>剩余话费：<%=loginCustomer.getCustomerBalance()%> 元</li>
                <li>当月话费已消费：<%=myPackage.getPrice() %> 元</li>
                <li>当月流量：<%=myPackage.getMobileDate()%> GB</li>
                <li>通话时长：<%=myPackage.getCallTime()%> 分钟</li>
            </ul>
            <div style="text-align: center">
                <a href="Recharge.jsp" class="button">充值</a>
            </div>
        </section>
    </div>
</div>
</body>
</html>
